<?php
class Custom_Controller_Action_Default_Controller extends Zend_Controller_Action {
	
	public function ckfinderAction() {
		$this->_helper->layout->disableLayout ();
	}
	
	public function sendEmail($email, $subject, $body) {
		$mail = new Zend_Mail();
		$mail -> addTo($email);
		$mail -> setSubject($subject);
		$mail -> setBodyHtml($body, 'UTF-8');

		//Send it!
		$sent = true;
		try {
			$mail -> send();
		} catch (Exception $e) {
			$sent = false;
		}

		//Do stuff (display error message, log it, redirect user, etc)
		if ($sent) {
			//TODO
		} else {
			//TODO
		}
	}

	public function genRandomString($length = 15) {
		$characters = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*ABCDEFGHIJKMLNOPQSRTUVXYZ';
		$string = '';
		for ($p = 0; $p < $length; $p++) {
			$string .= $characters[mt_rand(0, strlen($characters)-1)];
		}
		return $string;
	}
}
?>